/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on Dec 17, 2011, 3:35:39 PM
 */
package otobustakipsistemi;

import java.awt.BorderLayout;
import javax.swing.JPanel;


/**
 *
 * @author serhat
 */
public class MainScreen extends javax.swing.JFrame {
    private JPanel currentPanel;
    /** Creates new form NewJFrame */
    public MainScreen() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jToolBar1 = new javax.swing.JToolBar();
        ticket = new javax.swing.JButton();
        bus = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        ExitButton = new javax.swing.JButton();
        MenuBar = new javax.swing.JMenuBar();
        FileMenu = new javax.swing.JMenu();
        ExitMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Otobüs Takip Sistemi");
        setMinimumSize(new java.awt.Dimension(900, 700));

        jToolBar1.setRollover(true);

        ticket.setIcon(new javax.swing.ImageIcon(getClass().getResource("/otobustakipsistemi/ticket.png"))); // NOI18N
        ticket.setText("Bilet İşlemleri");
        ticket.setFocusable(false);
        ticket.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        ticket.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        ticket.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ticketActionPerformed(evt);
            }
        });
        jToolBar1.add(ticket);

        bus.setIcon(new javax.swing.ImageIcon(getClass().getResource("/otobustakipsistemi/bus.png"))); // NOI18N
        bus.setText("Otobüs");
        bus.setFocusable(false);
        bus.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        bus.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        bus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                busActionPerformed(evt);
            }
        });
        jToolBar1.add(bus);

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/otobustakipsistemi/driver.png"))); // NOI18N
        jButton1.setText("Personel");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);

        ExitButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/otobustakipsistemi/exit.png"))); // NOI18N
        ExitButton.setText("Çıkış");
        ExitButton.setFocusable(false);
        ExitButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        ExitButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        ExitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(ExitButton);

        getContentPane().add(jToolBar1, java.awt.BorderLayout.PAGE_START);

        FileMenu.setText("Dosya");

        ExitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
        ExitMenuItem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/otobustakipsistemi/exit.png"))); // NOI18N
        ExitMenuItem.setText("Çıkış");
        ExitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExitMenuItemActionPerformed(evt);
            }
        });
        FileMenu.add(ExitMenuItem);

        MenuBar.add(FileMenu);

        setJMenuBar(MenuBar);

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void ExitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitMenuItemActionPerformed
    System.exit(0);
}//GEN-LAST:event_ExitMenuItemActionPerformed

private void ExitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitButtonActionPerformed
    System.exit(0);
}//GEN-LAST:event_ExitButtonActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed

    EmployeePanel employeePanel = new EmployeePanel();
    if (currentPanel != null)
        remove(currentPanel);
    currentPanel = employeePanel;
    this.add(employeePanel, BorderLayout.CENTER);
    employeePanel.revalidate();
    
}//GEN-LAST:event_jButton1ActionPerformed

private void busActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_busActionPerformed
     BusPanel busPanel = new BusPanel();
     if (currentPanel != null)
        remove(currentPanel);
     currentPanel = busPanel;
     this.add(busPanel, BorderLayout.CENTER);
     busPanel.revalidate();
}//GEN-LAST:event_busActionPerformed

private void ticketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ticketActionPerformed
    TicketPanel ticketPanel = new TicketPanel();
     if (currentPanel != null)
        remove(currentPanel);
     currentPanel = ticketPanel;
     this.add(ticketPanel, BorderLayout.CENTER);
     ticketPanel.revalidate();
}//GEN-LAST:event_ticketActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MainScreen().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton ExitButton;
    private javax.swing.JMenuItem ExitMenuItem;
    private javax.swing.JMenu FileMenu;
    private javax.swing.JMenuBar MenuBar;
    private javax.swing.JButton bus;
    private javax.swing.JButton jButton1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JButton ticket;
    // End of variables declaration//GEN-END:variables
}
